/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package model.Entity.SIS;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 *
 * @author user12
 */
@Entity
@Table(name = "SIS_TIMES")
@NamedQueries({
    @NamedQuery(name = "Time.findAll", query = "SELECT s FROM Time s"),
    @NamedQuery(name = "Time.findByTimeCode", query = "SELECT s FROM Time s WHERE s.timeCode = :timeCode"),
    @NamedQuery(name = "Time.findByStartTime", query = "SELECT s FROM Time s WHERE s.startTime = :startTime"),
    @NamedQuery(name = "Time.findByEndTime", query = "SELECT s FROM Time s WHERE s.endTime = :endTime"),
    @NamedQuery(name = "Time.findByEntryDate", query = "SELECT s FROM Time s WHERE s.entryDate = :entryDate"),
    @NamedQuery(name = "Time.findByTerminal", query = "SELECT s FROM Time s WHERE s.terminal = :terminal"),
    @NamedQuery(name = "Time.findByOsUser", query = "SELECT s FROM Time s WHERE s.osUser = :osUser")})
public class Time implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "TIME_CODE")
    private Short timeCode;
    @Basic(optional = false)
    @NotNull
    @Column(name = "START_TIME")
    private int startTime;
    @Basic(optional = false)
    @NotNull
    @Column(name = "END_TIME")
    private int endTime;
    @Basic(optional = false)
    @NotNull
    @Column(name = "ENTRY_DATE")
    @Temporal(TemporalType.TIMESTAMP)
    private Date entryDate;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 30)
    private String terminal;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 30)
    @Column(name = "OS_USER")
    private String osUser;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "time")
    private List<SectionTime> sisSectionTimeList;

    public Time() {
    }

    public Time(Short timeCode) {
        this.timeCode = timeCode;
    }

    public Time(Short timeCode, int startTime, int endTime, Date entryDate, String terminal, String osUser) {
        this.timeCode = timeCode;
        this.startTime = startTime;
        this.endTime = endTime;
        this.entryDate = entryDate;
        this.terminal = terminal;
        this.osUser = osUser;
    }

    public Short getTimeCode() {
        return timeCode;
    }

    public void setTimeCode(Short timeCode) {
        this.timeCode = timeCode;
    }

    public int getStartTime() {
        return startTime;
    }

    public void setStartTime(int startTime) {
        this.startTime = startTime;
    }

    public int getEndTime() {
        return endTime;
    }

    public void setEndTime(int endTime) {
        this.endTime = endTime;
    }

    public Date getEntryDate() {
        return entryDate;
    }

    public void setEntryDate(Date entryDate) {
        this.entryDate = entryDate;
    }

    public String getTerminal() {
        return terminal;
    }

    public void setTerminal(String terminal) {
        this.terminal = terminal;
    }

    public String getOsUser() {
        return osUser;
    }

    public void setOsUser(String osUser) {
        this.osUser = osUser;
    }

    public List<SectionTime> getSisSectionTimesList() {
        return sisSectionTimeList;
    }

    public void setSisSectionTimesList(List<SectionTime> sisSectionTimeList) {
        this.sisSectionTimeList = sisSectionTimeList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (timeCode != null ? timeCode.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Time)) {
            return false;
        }
        Time other = (Time) object;
        if ((this.timeCode == null && other.timeCode != null) || (this.timeCode != null && !this.timeCode.equals(other.timeCode))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "model.SisTimes[ timeCode=" + timeCode + " ]";
    }
    
}
